<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    
    /**
     * 成功返回信息
     * @param $data
     * @param int $status
     * @param string $msg
     * @return array
     */
    public function ReturnSuccess($msg='success', $data='', $status=200){
        return [
            'message' => $msg,
            'status_code' => $status,
            'data'=> $data,
        ];
    }

    /**
     * 失败返回信息
     * @param int $status
     * @param string $msg
     * @param string $data
     * @return array
     */
    public function ReturnError($msg='error', $data='', $status=400){
        return [
            'message' => $msg,
            'status_code' => $status,
            'data'=>$data,
        ];
    }
}
